package com.ke.rule.base;

/**
 * 功能部件的应用类型
 * 
 * 在执行具体的功能部件时，需要接收一部分外部入参，用该枚举来定义这些入参的类型
 * 
 * @author guyu
 *
 */
public enum ApplyToType {
  ENTITY("entity"),
  FIELD("field"),
  ACTION("action"),
  EVENT("event");
  
  private String value;

  private ApplyToType(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }
  
  /**
   * get enum by value
   * @param value
   * @return
   */
  public static ApplyToType of(String value) {
    for (ApplyToType type : ApplyToType.values()) {
      if (type.value.equalsIgnoreCase(value)) {
        return type;
      }
    }
    throw new IllegalArgumentException("invalid enum value(" + value + ")");
  }
}
